package com.bxsy.modules.shiro.web;

import com.alibaba.fastjson.JSONObject;
import com.bxsy.common.api.vo.Result;
import lombok.extern.slf4j.Slf4j;
import org.apache.shiro.SecurityUtils;
import org.apache.shiro.subject.Subject;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

/**
 * @类描述：
 * @项目名称：bxsy
 * @包名： com.bxsy.modules.shiro.web
 * @类名称：LogoutController2
 * @author：liuwei@minemis.com
 * @创建时间：2019/4/8 13:57
 *  
 */
@Controller
@Slf4j
public class LogoutController {
    @PostMapping("/api/auth/logout")
    @ResponseBody
    public Result logout(){
        log.info("---安全登出---");
        Result<JSONObject> result = new Result<JSONObject>();
        Subject subject = SecurityUtils.getSubject();
        subject.logout();
        result.success("安全登出");
        return result;
    }
}



